#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QLCDNumber>
#include "Aria.h"
#include "ArNetworking.h"
#include "types.h"
#include "myrobot.h"
#include "drive.h"
#include "handlerupdate.h"
#include "handlermap.h"
#include "handlergoals.h"
#include "handlersensor.h"
#include "handlerpath.h"
#include "handlercamera.h"
#include "mygraphicsscene.h"
#include "mygoalitem.h"
#include "localizationwindow.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
signals:


    void signal_update_camera(int,int,int);
    void signal_changed_localization_button(bool);


public:
    explicit MainWindow(QWidget *parent = 0,ArClientBase *cliente = 0);
    ~MainWindow();





    
private slots:
    void on_actionQuit_triggered();

    void on_checkBox_Hide_Controls_stateChanged(int arg1);

    void on_actionVideo_changed();

    void on_actionGoals_changed();

    void on_actionRobot_Tools_changed();

    void on_actionMap_Tools_changed();

    void on_actionAdvanced_Tools_changed();

    void on_actionMap_changed();

    void on_actionFit_in_Window_activated();

    void slot_draw_Ellipse(QGraphicsEllipseItem *);
    void slot_draw_Line(QGraphicsLineItem *);

    void slot_remove_Ellipse(QGraphicsEllipseItem *);
    void slot_remove_Line(QGraphicsLineItem *);


    void slot_scene_changed(QRectF);

    void on_button_goto_clicked();

    void on_actionReduce_triggered();

    void on_actionMagnify_triggered();

    void on_actionDrive_triggered(bool checked);

    void slotUpdateNumbers(double,double,double,double,int,int);

    void slotUpdateStrings(char *,char *);

    void slotUpdatebatteryInfo(double,double);

    void slotHideDrive();

    void slot_add_goal(QString);

    void slot_remove_goals();

    void on_actionStop_triggered();

    void on_actionWander_triggered();

    void on_actionTour_Goals_triggered();

    void on_actionHome_triggered();

    void on_actionDock_triggered();

    void on_actionSafe_Drive_triggered(bool checked);

    void on_actionAuto_Dock_triggered(bool checked);

    void on_actionSend_Robot_triggered(bool checked);

    void slot_paint_image(uchar *,int);

    void slot_get_camera_values(int,int,int,int,int,int,int);

    void on_sliderpan_valueChanged(int value);

    void on_slidertilt_valueChanged(int value);

    void on_sliderzoom_valueChanged(int value);

    void slot_paint_rect(QGraphicsRectItem *);

    void slot_remove_rect(QGraphicsRectItem *);

    void slot_paint_goal(myGoalItem *);

    void slot_remove_goal(myGoalItem *);

    void on_actionLocalize_to_Point_triggered(bool checked);

    void slot_changed_localization_button(bool);

    void slot_no_camera_exits();

    void on_button_Reset_Camera_clicked();


    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_6_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_8_clicked();

    void on_sliderpan_rangeChanged(int min, int max);

    void on_slidertilt_rangeChanged(int min, int max);

    void on_sliderzoom_rangeChanged(int min, int max);

private:

    Ui::MainWindow *ui;

    myRobot *robot;

    Drive *wdrive;

    LocalizationWindow *locWindow;

    handlerUpdate *handleupdate;
    handlerMap *handlemap;
    handlerGoals *handlergoals;
    handlerSensor *handlesensor;
    handlerPath *handlepath;
    handlerCamera *handlecamera;


    void hide_robot_controls();
    void hide_battery_controls();
    void hide_camera();

    ArClientBase *client;

    myGraphicsScene *grascene;
    QGraphicsScene *grascene_video;
    QLCDNumber LCD_voltage_actual;
    QLCDNumber LCD_voltage_warning;
    QLCDNumber LCD_voltage_off;

   void hide_goals();

   ArFunctor1C<MainWindow,ArNetPacket *> getSafeDriveCB;
   ArFunctor1C<MainWindow,ArNetPacket *> getAutoDockCB;

   void getSafeDrive(ArNetPacket *packet);
   void getAutoDock(ArNetPacket *packet);



};

#endif // MAINWINDOW_H
